package com.bwie.controller;

import com.bwie.common.domaintoo.request.CouponAdd;
import com.bwie.common.domaintoo.request.CouponRequest;
import com.bwie.common.result.Result;
import com.bwie.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @className: MenuController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 * @date: 2025/9/27 19:36
 */
@CrossOrigin
@RestController
public class CouponController {
    @Autowired
    CouponService couponService;

    /**
     * 所有优惠卷列表
     * @param couponRequest
     * @return
     */
    @PostMapping("list")
    public Result list(@RequestBody CouponRequest couponRequest){
        return couponService.list(couponRequest);
    }
    /**
     * 添加优惠卷
     * @param couponAdd
     * @return
     */
    @PostMapping("couponAdd")
    public Result couponAdd(@RequestBody CouponAdd couponAdd){
        return couponService.couponAdd(couponAdd);
    }
    /**
     * 优惠卷类型
     * @param id
     * @return
     */
    @GetMapping("typeList/{id}")
    public Result typeList(@PathVariable String id){
        return couponService.typeList(id);
    }
    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping("img")
    public Result img(@RequestBody MultipartFile file){
        return couponService.img(file);
    }


}
